package com.zou.lotterylucky.adapters

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.zou.lotterylucky.activity.BetCountEntity
import com.zou.lotterylucky.R
import java.text.DecimalFormat

class BetsListAdapter(data: MutableList<BetCountEntity>) :
    BaseQuickAdapter<BetCountEntity, BaseViewHolder>(R.layout.item_bet_no_opt, data) {

    override fun convert(helper: BaseViewHolder, item: BetCountEntity) {
        val moneyFormat = DecimalFormat("0.00")
        helper.setText(R.id.textNum, item.getNumber())
            .setText(R.id.textMoney, moneyFormat.format(item.money))
            .setText(R.id.textPool, if (item.pool) "Pool" else "")
            .setVisible(R.id.textPrize, item.isWinner == 1)
            .setText(R.id.textPrize, moneyFormat.format(item.prizes))
    }
}